package com.rich.im.controller;

import com.rich.common.entity.Message;
import com.rich.im.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author HanSama
 * @date 2021年08月19日 14:30
 */
@RestController
@RequestMapping("/message")
public class MessageController {

    @Autowired
    private MessageService messageService;

    /**
     * 获取与某人的聊天记录
     * @author HanSama
     * @date 2021/8/19 14:37
     * @param fromId
     * @param toId
     * @return java.util.List<com.rich.common.entity.Message>
     */
    @GetMapping("/findListByFromAndTo/{fromId}/{toId}")
    public List<Message> findListByFromAndTo(@PathVariable("/fromId") Long fromId,@PathVariable("/toId") Long toId){
        return messageService.findListByFromAndTo(fromId,toId);
    }





}
